<div data-hook="variants">
  <fieldset class="no-border-top no-border-bottom">
    <div class="row">
      <div class="col-xs-3">
        <div class="field" data-hook="sku">
          <%= f.label :sku %>
          <%= f.text_field :sku, :class => 'fullwidth' %>
        </div>
      </div>
      <div class="col-xs-3">
        <div class="field checkbox" data-hook="track_inventory">
          <%= f.label :track_inventory do %>
            <%= f.check_box :track_inventory %>
            <%= Spree::Variant.human_attribute_name(:track_inventory) %>
          <% end %>
        </div>
      </div>
    </div>
  </fieldset>
  <% if f.object.new_record? %>
    <fieldset class="no-border-top no-border-bottom">
      <div class="row">
      <% @product.option_types.each_with_index do |option_type, index| %>
          <div class="col-xs-3">
            <div class="field" data-hook="presentation">
              <%= label :new_variant, option_type.presentation %>
              <%= f.collection_select 'option_value_ids',
                                      option_type.option_values,
                                      :id,
                                      :presentation,
                                      { include_blank: true },
                                      {
                                        name: 'variant[option_value_ids][]',
                                        class: "select2 fullwidth"
                                      } %>
            </div>
          </div>
      <% end %>
      </div>
    </fieldset>
  <% end %>
</div>

<div data-hook="admin_variant_form_additional_fields">
  <fieldset class="no-border-top no-border-bottom">
    <div class="row">
      <% [:weight, :height, :width, :depth].each_with_index do |field, index| %>
        <div class="col-xs-3">
          <div class="field" data-hook="<%= field %>">
            <%= f.label field %>
            <%= f.text_field field,
                            value: number_with_precision(@variant.send(field), :precision => 2),
                            class: 'fullwidth' %>
          </div>
        </div>
      <% end %>
    </div>
  </fieldset>
</div>

<div data-hook="admin_variant_form_fields">
  <fieldset class="no-border-top no-border-bottom">
    <p> <%== t('.pricing_hint') %> </p>

    <div class="row">
      <div class="col-xs-3">
        <div class="field" data-hook="price">
          <%= f.label :price %>
          <%= f.text_field :price, :value => number_to_currency(@variant.price, :unit => ''), :class => 'fullwidth' %>
        </div>
      </div>

      <% if show_rebuild_vat_checkbox? %>
        <div class="col-xs-3">
          <%= render "spree/admin/shared/rebuild_vat_prices_checkbox", form: f, model_name: "variant", wrapper_class: "field" %>
        </div>
      <% end %>

      <div class="col-xs-3">
        <div class="field" data-hook="cost_price">
          <%= f.label :cost_price %>
          <%= f.text_field :cost_price, :value => number_to_currency(@variant.cost_price, :unit => ''), :class => 'fullwidth' %>
        </div>
      </div>

      <div class="col-xs-3">
        <div class="field" data-hook="tax_category">
          <%= f.label :tax_category %>
          <%= f.field_hint :tax_category %>
          <%= f.collection_select :tax_category_id,
                                  @tax_categories,
                                  :id,
                                  :name,
                                  { :include_blank => t('.use_product_tax_category') },
                                  { :class => 'select2 fullwidth' } %>
        </div>
      </div>
    </div>
  </fieldset>
</div>



<div class="clear"></div>
